# https://www.jinglingshuju.com/articles
import json
import subprocess

import requests

headers = {
    "origin": "https://www.jinglingshuju.com",
    "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36"
}
url = "https://vapi.jinglingshuju.com/Data/getNewsList"
data = {
    "page": "1",
    "num": "20",
    "uid": "undefined"
}
response = requests.post(url, headers=headers, data=data).json()
encrypt_data = response['data']
print(encrypt_data)
# js_code_path = 'jlsj.js'
js_code_path = '精灵数据.js'
cmd = ['node', js_code_path, encrypt_data]

result = subprocess.run(cmd, capture_output=True, text=True, encoding='utf-8')
decrypt_data = result.stdout.strip()
# print(decrypt_data)
# print(type(decrypt_data))
# print( json.loads(decrypt_data))
# for item in json.loads(decrypt_data)['list']:
#     print(item)
# print()
for item in json.loads(decrypt_data)['list']:
    print(item)
